
class CheckBoxThing < Thing
  attribute :content

  def recieve e
    if e.params[form_id :present]
      content = e.params[form_id(:value)]
      if content == "checked"
        @content = true
      else
        @content = false
      end
    end
  end

  def creator e
    e = Element.new(
      :input,
      :type => 'checkbox',
      :name => (form_id :value),
      :value => 'checked'
    )
    if content
      e.checked = "checked"
    end
    e.to_s + InputHidden.new(:name => (form_id :present), :value => '1').to_s
  end

  def render e
    ''
  end
end